import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);


const router=new  VueRouter({
    mode:"hash",
    routes:[
        {
            path:"/index",
            component:()=>import("@/views/index.vue"),
            name:"index"
        },
        {
            path:"/course",
            component:()=>import("@/views/course.vue"),
            name:"course"
        },
        {
            path:"/practice",
            component:()=>import("@/views/practice.vue"),
            name:"practice"
        },
        {
            path:"/record",
            component:()=>import("@/views/record.vue"),
            name:"record"
        },
        {
            path:"/user",
            component:()=>import("@/views/user.vue"),
            name:"user"
        },
        {
            path:"/custmoer",
            component:()=>import("@/views/custmoer.vue"),
            name:"custmoer"
        },
        {
            path:"/login",
            component:()=>import("@/views/login.vue"),
            name:"login"
        },
        {
            path:"/smslogin",
            component:()=>import("@/views/smslogin.vue"),
            name:"smslogin"
        },
        
        {
            path:"/",
            redirect:"/index"
        }

    ]
})

const originalPush= VueRouter.prototype.push
// 重写push函数
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}



export default router;